//
//  MSMoreView.m
//  MSJD
//
//  Created by xiangbo on 2018/12/3.
//  Copyright © 2018 xiangbo. All rights reserved.
//

#import "MSMoreView.h"

@implementation MSMoreView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupSubviews];
    }
    return self;
}

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubviews];
    }
    return self;
}

- (void)setupSubviews{
    self.contentView.backgroundColor = [UIColor whiteColor];
    self.moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.moreButton setTitle:@"查看全部" forState:UIControlStateNormal];
    [self.moreButton setTitleColor:UIColorHex(0xF96332) forState:UIControlStateNormal];
    self.moreButton.layer.borderColor = UIColorHex(0xdddddd).CGColor;
    self.moreButton.layer.borderWidth = 1.f;
    self.moreButton.layer.cornerRadius = 20;
    self.moreButton.titleLabel.font = [UIFont systemFontOfSize:12.f];
    [self.moreButton addTarget:self action:@selector(moreAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.moreButton];
    
    [self.moreButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
        make.width.mas_equalTo(160);
        make.height.mas_equalTo(40);
    }];
}

- (void)moreAction:(id)sender{
    [self routerEventWithName:kMoreButtonClicked userInfo:nil];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
